<template>
	<view>
		<!-- <uni-collapse>
			<uni-collapse-item title="标题文字" showAnimation>
				<view class="content">折叠内容主体，可自定义内容及样式</view>
			</uni-collapse-item>
			<uni-collapse-item title="标题文字" showAnimation>
				<view class="text">折叠内容主体</view>
			</uni-collapse-item> 
		</uni-collapse> -->
		<textarea v-model="content" placeholder="请输入内容"></textarea>
		<view class="py-2 px-3">
			<button class="bg-main text-white" style="border-radius: 50rpx;border: 0;" type="primary" :disabled="disabled" :class="disabled ? 'bg-main-disabled' : ''" @click="submit">举报用户</button>
			<!-- <button class="bg-main text-white" style="border-radius: 50rpx;border: 0;" type="primary" @click="submit">意见反馈</button> -->
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex';
	import uniCollapse from '@/components/uni-ui/uni-collapse/uni-collapse.vue';
	import uniCollapseItem from '@/components/uni-ui/uni-collapse-item/uni-collapse-item.vue';
	export default {
		components: {
			uniCollapse,
			uniCollapseItem
		},
		data() {
			return {
				content:"",
				reportedId:0
			}
		},
		computed: {
			...mapState({
				user:state=>state.user
			}),
			disabled() {
				
			}
		},
		onLoad(e){
			this.reportedId = e.id
		},
		methods: {
			submit(){
				let user=this.$store.state.user
				let obj={
					informerId:user.id,
					reportedId:this.reportedId,
					content:this.content
				}
				console.log(obj);
				this.$H.post('/user/feedback/'+user.id,obj,{
					token:true
				}).then(res=>{
					console.log(obj);
					uni.navigateBack({
						delta: 1
					});
					uni.showToast({
						title: '举报成功',
						icon: 'none'
					});
				})
			}
		}
	}
</script>

<style>
    textarea {
      width: 100%;
      height: 100px;
      padding: 10px;
      border: 1px solid #ccc;
      border-radius: 5px;
      font-size: 14px;
    }
</style>
